/*****************************************************
 * created by deming.su on 2020-07-28 for entry file
 *****************************************************/

/** 引入express */
const express = require("express");

/** 引入助手类 */
const {logs} = require('./util');

/** 配置文件 */
const {SERVER_PORT} = require('./config');

/** 实例化 */
const app = express();

/** 添加消息体转义中间件 */
app.use(express.json());
app.use(express.urlencoded({extended: false}));

/** 添加静态中间件 */
const path = require('path');
app.use(express.static(path.join(__dirname, 'public'), {index: 'login.html'}));

/** 对接口进行监听 */
app.listen(SERVER_PORT, () => {
    logs(`service started on port: ${SERVER_PORT}`);
});

/** 引入Router */
const Router = require('./router');
Router(app);